import Toast from '@vant/weapp/toast/toast';
Page({
  data: {
    username: "",
    phone: "",
    fileList: [],
  },
  onLoad(options) {},
  onChange(event) {
    // event.detail 为当前输入的值
    console.log(event.detail);
  },
  onChangePhone(event) {
    console.log(event.detail);
  },
  afterRead(event) {
    const { file } = event.detail;
    // 当设置 mutiple 为 true 时, file 为数组格式，否则为对象格式
    wx.uploadFile({
      url: 'https://example.weixin.qq.com/upload', // 仅为示例，非真实的接口地址
      filePath: file.url,
      name: 'file',
      formData: { user: 'test' },
      success(res) {
        // 上传完成需要更新 fileList
        const { fileList = [] } = this.data;
        fileList.push({ ...file, url: res.data });
        this.setData({ fileList });
      },
    });
  },
  goComfirl() {
    Toast('投递成功');
    setTimeout(() => {
      wx.switchTab({
      url: '../../pages/index/index' // 指定页面的url
    });
    }, 2000);
    

  }
});
